import { http } from '@/utils/http'
import type { GoodsSku, GoodsSkuQuery, CategorySkuQuery, GoodsInfoVo } from './goods.d'

/**
 * 商品SKU接口集合
 */

/** 分页查询商品SKU  分页查询商品sku */
export const pageList = (params: GoodsSkuQuery) => {
  return http<PageResult<GoodsSku>>({
    url: '/goods/sku/list',
    method: 'GET',
    query: params,
  })
}

/** 按分类查询id SKU  根据分类查询sku */
export const pageByCategory = (params: CategorySkuQuery) => {
  return http<PageResult<GoodsSku>>({
    url: '/goods/sku/ByCategoryId/list',
    method: 'GET',
    query: params,
  })
}

// 商品详情
export const getGoodsDetail = (id: string) => {
  return http<GoodsInfoVo>({
    url: '/goods/info',
    query: { id },
    method: 'GET',
  })
}
